package com.fw.service.impl;

import java.util.List;

import com.fw.dao.UserDao;
import com.fw.dao.impl.UserDaoImpl;
import com.fw.service.UserService;

public class UserServiceImpl implements UserService {

    private UserDao userDao;

    //setter注入
    public void setUserDao(UserDao userDao) {
        this.userDao = userDao;
    }
    @Override
    public List<String> getAllUsers() {
        System.out.println("==UserServcie获取用户列表：===");
        return userDao.findAllUsers();
    }

    @Override
    public String getUserInfo(int id) {
        // TODO Auto-generated method stub
        return userDao.findUserById(id);
    }

    @Override
    public void registerUser(String username) {
        System.out.println("===UserServcie注册用户："+username);
        userDao.addUser(username);   
     }

    @Override
    public int getUserCount() {
        List<String> users=userDao.findAllUsers();
        return users.size();
    }

}
